﻿using Framework.Core.Reflection;

namespace Framework.Core.Recorder
{
    internal class StateFullCallKeyBuilder : ICallKeyBuilder
    {
        private readonly ICallKeyBuilder callKeyBuilder;

        private int counter;

        internal StateFullCallKeyBuilder(ICallKeyBuilder callKeyBuilder)
        {
            this.callKeyBuilder = callKeyBuilder;
        }

        public StateFullCallKeyBuilder()
            : this(new CallKeyBuilder())
        {
        }

        public string Build(IMethod method)
        {
            counter++;
            return string.Format("{0}_{1}", counter, callKeyBuilder.Build(method));
        }
    }
}